/*------------------------------------------------------------------------------*\
**
**  adventure_map_window_base.h
**
**			Heroes IV
**	  Copyright 2001, The 3DO Company
**
\*------------------------------------------------------------------------------*/

#ifndef ADVENTURE_MAP_WINDOW_BASE_H_INCLUDED
#define ADVENTURE_MAP_WINDOW_BASE_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "adventure_map_ptr.h"
#include "bitmap_group_ptr.h"
#include "bitmap_group_window_ptr.h"
#include "game_window.h"
#include "map_renderer.h"
#include "paint_surface.h"
#include "memory_bitmap.h"

class  t_adventure_frame;

class t_adventure_map_window_base : public t_window, public t_map_renderer
{
public:
    t_adventure_map_window_base ( t_screen_rect const& rect, t_adventure_frame* frame_ptr, t_window* parent_ptr );
	void					center_view( t_screen_point point );
	void                    center_view( t_level_map_point_2d const& point );
	t_adventure_frame*		get_frame() const;
	t_adventure_map const&	get_map() const;
	t_adventure_map&		get_map();
	void                    move_view( t_screen_point point );
	virtual void			paint( t_paint_surface& paint_surface );

protected:
	t_shared_ptr<t_memory_bitmap16>	m_back_buffer;
	t_adventure_frame*				m_frame;
	t_adventure_map_ptr				m_map;

	virtual t_abstract_bitmap16_ptr create_back_buffer( t_screen_point const & view_size );
	virtual void			on_rects_dirtied( std::vector< t_screen_rect > const & dirtied_rects );
	virtual void			on_view_moved( int new_view_level, t_screen_point const & new_view_pos, 
		                                t_screen_point const & new_view_size );
};

inline t_adventure_frame* t_adventure_map_window_base::get_frame() const
{
	return m_frame;
}

#endif // ADVENTURE_MAP_WINDOW_BASE_H_INCLUDED
